package com.itheima.demo3genericity;

import java.util.ArrayList;


public class StudentData implements Data<Student>
{
    ArrayList<Student> list = new ArrayList<>();
    @Override
    public void add(Student student) {
        //添加
    list.add(student);
    System.out.println(list);
    }

    @Override
    public void remove(Student student) {
        //删除
        list.remove(student);
        System.out.println(list);

    }

    @Override
    public void search(int id) {
        //查询
        for (Student s : list) {
            if (s.getId() == id) {
                System.out.println(s);
                return;
            }
        }
    }

    @Override
    public void update(Student student) {

    }
}
